<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVCWeb.Models.Ads>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript">
        $(document).ready(function() {
            $("#AdsForm").validate({
                rules: {
                    Type: {
                        required: true
                    },
                    ContributionAmt:
                    {
                        required: true,
                        number: true
                    },
                    ContributionType: {
                        required: true
                    },

                },
                messages: {
                    Type: {
                        required: "Ads Type must be entered"
                    },
                    ContributionAmt: {
                        required: "Contribution Amt must be entered",
                        number: "Contribution Amt must be only valid number"            
                    },
                    ContributionType: {
                        required: "Contribution Type must be entered"
                    }
                }
            });
            $("#submit_view").click(function() {
                $("#IsRedirectToView").val("true");
            });
        });
    </script>

    <h2>
        Edit Ads</h2>
    <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
    <% using (Html.BeginForm("Edit", "Ads", FormMethod.Post, new { id = "AdsForm" }))
       {%>
    <fieldset>
        <legend>Edit Ads</legend>
        <p style="display: none">
            <label for="AdsId">
                AdsId:</label>
            <%= Html.TextBox("AdsId", Model.AdsId) %>
            <%= Html.ValidationMessage("AdsId", "*") %>
        </p>
        <p>
            <label for="Type">
                Type:</label>
            <%= Html.TextBox("Type", Model.Type) %>
            <%= Html.ValidationMessage("Type", "*") %>
        </p>
        <p>
            <label for="Description">
                Description:</label>
            <%= Html.TextArea("Description", Model.Description) %>
            <%= Html.ValidationMessage("Description", "*") %>
        </p>
        <p>
            <label for="ContributionAmt">
                Contribution Amt:</label>
            <%= Html.TextBox("ContributionAmt", String.Format("{0:F}", Model.ContributionAmt)) %>
            <%= Html.ValidationMessage("ContributionAmt", "*") %>
        </p>
        <p>
            <label for="ContributionType">
                ContributionType:</label>
            <%= Html.TextBox("ContributionType", Model.ContributionType) %>
            <%= Html.ValidationMessage("ContributionType", "*") %>
        </p>
        <p>
            <label for="DisplayTemplate">
                Display Template:</label>
            <%= Html.TextArea("DisplayTemplate", Model.DisplayTemplate) %>
            <%= Html.ValidationMessage("DisplayTemplate", "*") %>
        </p>
        <p>
            <%= Html.Hidden("IsRedirectToView")%>
            <input id="submit" name="submit" type="submit" value="Update" />
            <input id="submit_view" name="submit_view" type="submit" value="Update & View" />            
            <input type="reset" value="Reset" />
        </p>
    </fieldset>
    <% } %>
    <div>
        <%=Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <title>Edit Ads</title>
</asp:Content>
